<div class="easyui-layout" data-options="fit:true">
    <form id="uploadPicForm" method="post" enctype="multipart/form-data">
        <input type="hidden" id="uploadTargetId" name="uploadTargetId"/>
        <div data-options="region:'center'">
            <div class="easyui-tabs">
                <div title="上传风控图片">
                    <table class="inputTable">
                        <tr>
                            <td> 文件类型</td>
                            <td>
                                <div>
                                    <input name="oType" class="easyui-combobox" data-options="url:'/dictionary/oType'"/>
                                </div>
                            </td>
                        </tr>
                        <tr>
                            <td>证明文件</td>
                            <td>
                                <div id="uploader" class="wu-example">
                                    <!--用来存放文件信息-->
                                    <div class="btns">
                                        <div id="picker">选择图片</div>
                                    </div>
                                    <div id="imglist" class="uploader-list"></div>
                                </div>
                            </td>

                        </tr>

                    </table>
                </div>
            </div>
        </div>
    </form>
    <div data-options="region:'south',border:false" style="text-align:right;padding:5px">
        <a class="easyui-linkbutton update" data-options="iconCls:'fa fa-save'" href="javascript:;"
           style="width:80px">提交</a>
        <a class="easyui-linkbutton" data-options="iconCls:'fa fa-close '" href="javascript:;"
           onclick="javascript:$('#uploadWin').window('close')" style="width:80px">取消</a>
    </div>
</div>
<script type="text/javascript" src="/static/webuploader-0.1.5/bdup.js"></script>
<script type="text/javascript">
    var uploadPic = "/target/uploadPic";
    var option = {
        imgList: "#imglist", pick: {id: "#picker", multiple: false}, inputName: "fileContent"
    };
    bdup(option);
    $(".update").click(function () {
        var oType = $("input[name =oType]").val();
        if (oType == "") {
            $.messager.alert('操作提示', '请选择文件类型 !', 'info');
            return;
        }
        if ($("input[name=fileContent]").length == 0) {
            $.messager.alert('操作提示', '请上传图片 !', 'info');
            return;
        }
        if ($("input[name=fileContent]").length > 1) {
            $.messager.alert('操作提示', '请上传一张图片 !', 'info');
            return;
        }
        $.messager.progress();

        $('#uploadPicForm').form('submit', {
            url: uploadPic,
            success: function (data) {
                $.messager.progress('close');
                data = $.parseJSON(data);
                $.messager.show({
                    title: '操作结果',
                    msg: data.message,
                    timeout: 2000,
                    showType: 'slide'
                });
                debugger;
                if (data.state == "SUCCESS") {
                    //关闭窗口
                    $("#uploadWin").window("close");
                    // 重新加载表格
                    $("#list").datagrid('load');
                    // 重新加载标的详情页
                    $("#detailsWin").window({
                        onLoad: function () {
                            $("#targetInfo").tabs("select", 2);
                        }
                    }).window("open").window("refresh", detailUrl);

                }
            }
        });
    });

</script>
